Average die roll w/rerolling

General questions, debates, and rants about RPGs

Moderator: Moderators

Post Reply
Lago PARANOIA
Invincible Overlord
Posts: 10555
Joined: Thu Sep 25, 2008 3:00 am

Average die roll w/rerolling

Post by Lago PARANOIA »

Okay, so the formula for finding an average die roll is simple enough.

So what about rerolls?

Say for example you're allowed to roll a dice twice and take the higher number. How do you calculate the average for that?
ggroy
Knight
Posts: 386
Joined: Wed Jul 01, 2009 3:51 pm

Re: Average die roll w/rerolling

Post by ggroy »

Last edited by ggroy on Sat Mar 13, 2010 8:16 pm, edited 1 time in total.
ggroy
Knight
Posts: 386
Joined: Wed Jul 01, 2009 3:51 pm

Re: Average die roll w/rerolling

Post by ggroy »

Last edited by ggroy on Sat Mar 13, 2010 8:16 pm, edited 7 times in total.
TarkisFlux
Duke
Posts: 1147
Joined: Sun Jun 22, 2008 9:44 pm
Location: Magic Mountain, CA
Contact:

Post by TarkisFlux »

With some measure of work.

If you get the single highest die from a pool, which rerolling a single die a few times counts as, you can use the following trick:

The probability of rolling "A or better" on Y number of dice numbered from 1 to X is:
( (X)^Y - (A-1)^Y ) / (X) ^ Y

If you really care about only the probability of rolling A, you need to subtract the probability of A+1 or better from the probability of A or better. Once you have the probability of each result, you multiply each probability by the result and sum for the average.

Example
6 or better on 3d6 is (6^3-5^3)/6^3 = (216-125)/216 = 42.13%
5 or better on 3d6 is (6^3-4^3)/6^3 = (216-64)/216 = 70.30%
5 exactly is 70.3%-42.13% = 28.17%
This has some slightly technical limitations, but they're worth pointing out to save you headaches. You cannot use this if you are adding any of the dice together and you can't splice this into any probability for getting a result and then adding it to another one unless the rolls could be treated as separate events. You can't break up SR4 style dice pools into discrete chunks and try to apply this, because it doesn't cover the possibility that you'll get all of your hits in the first pile and none in the latter. So this would work for getting 5 or better on 3d6 and 7 or better on 2d8, and then multiplying through for the combined probability, but not for getting two dice of 5 or better from 4d6. You just don't cover all of the possible states completely enough to get real results out.

So, if you care about multiple dice, because they need to be high enough or you want to add some together, you need to do some real work determining which available states degenerate into which results, and then multiplying the size of each state's bin by the result of that state and dividing by the total number of states. determining which result they generate, and then figuring the average from there. Since you can't really cheat on the sticking of states into results for lots of complicated setups (4d6 toss lowest for example, who's average is 12.8 or something in case you were curious), your best bet is to get your hands dirty with a spreadsheet or coding.
Last edited by TarkisFlux on Thu Jul 16, 2009 2:36 am, edited 1 time in total.
The wiki you should be linking to when you need a wiki link - http://www.dnd-wiki.org

Fectin: "Ant, what is best in life?"
Ant: "Ethically, a task well-completed for the good of the colony. Experientially, endorphins."
Heath Robinson
Knight
Posts: 393
Joined: Sun Aug 17, 2008 9:26 am
Location: Blighty

Post by Heath Robinson »

An optimised procedure is to Sum (2x^2 - x) for x = [1,n] then divide the final result by n^2.

Code: Select all

let X be the distribution of the first roll
let Y be the distribution of the second roll
let f be a function that transforms its two argument distributions into a single distribution that reflects the reroll behaviour

P( X = x) = 1/n
P&#40; Y <= y&#41; = y/n
P&#40; X = x & Y <= x&#41; = &#40;1/n&#41; * &#40;x/n&#41; = x/&#40;n^2&#41;

P&#40; X = x & Y = x+i&#41; = &#40;1/n&#41; * &#40;1/n&#41; = 1/&#40;n^2&#41;

E&#40; f&#40; x, Y&#41;&#41; = x * P&#40; X = x & Y <= x&#41; + Sum&#40; ForEach i in &#91;1, n-x&#93; &#58; &#40;x + i&#41; * P&#40; X = x & Y = x + i&#41;&#41;
= x^2 / n^2 + Sum&#40; ForEach i in &#91;1, n-x&#93; &#58; &#40;x + i&#41; / n^2&#41;

let y = x+i

E&#40; f&#40; x, Y&#41;&#41; = x^2 / n^s + Sum&#40; ForEach y in &#91;x+1, n&#93; &#58; y / n^2&#41;

The contribution that y makes to the E&#40; f&#40; X, Y&#41;&#41; is &#40;y-1&#41;y / n^2 because E&#40; f&#40; X, Y&#41;&#41; = Sum&#40; ForEach x in &#91;1, n&#93; &#58; E&#40; f&#40; x, Y&#41;&#41;&#41;
Each value of x adds y/n^2 for all values x < y <= n.

To demonstrate, it's intuitively obvious that 2 only contributes to E when x = 1, hence it only contributes once.  When y = 3, it contributes when x is 1, or 2.  Hence, 2.

E&#40; f&#40; X, Y&#41;&#41; = Sum&#40; ForEach x in &#91;1, n&#93; &#58; x^2/n^2&#41; + Sum&#40; ForEach y in &#91;1, n&#93; &#58; y&#40;y-1&#41; / n^2&#41;
= Sum&#40; ForEach x in &#91;1,n&#93; &#58; x^2/n^2 + x&#40;x-1&#41;/n^2&#41;
= Sum&#40; ForEach x in &#91;1,n&#93; &#58; x^x + x&#40;x-1&#41;&#41; / n^2
= Sum&#40; ForEach x in &#91;1,n&#93; &#58; 2x^2 - x&#41; / n^2
For 1d6 (rerolled)

Code: Select all

x = 1 &#58; 2 * 1 - 1 = 1
x = 2 &#58; 2 * 4 - 2 = 6
x = 3 &#58; 2 * 9 - 3 = 15
x = 4 &#58; 2 * 16 - 4 = 28
x = 5 &#58; 2 * 25 - 5 = 45
x = 6 &#58; 2 * 36 - 6 = 66

Sum = 161
Divided = 161 / 36 = 4.472...
For multiple dice, just add the Expectations of each individual dice.
Last edited by Heath Robinson on Thu Jul 16, 2009 11:55 am, edited 4 times in total.
Face it. Today will be as bad a day as any other.
User avatar
hogarth
Prince
Posts: 4582
Joined: Wed May 27, 2009 1:00 pm
Location: Toronto

Post by hogarth »

For an n-sided die, the formula for the average of the maximum of two rolls is:

1/6n*(4n^2+3n-1)
User avatar
hogarth
Prince
Posts: 4582
Joined: Wed May 27, 2009 1:00 pm
Location: Toronto

Post by hogarth »

Note that as n -> infinity, the average will approach 2/3*n.

Average for 2d6, take the highest: 4.472
Average for 2d20, take the highest: 13.825
Average for 2d100, take the highest: 67.165
Post Reply